#include <bits/stdc++.h>
using namespace std;
#define ll long long 
const int MAX = 35;
char str[MAX] = {0};
int main(void)
{
    ll n = 0;
    scanf(" %s %lld",str,&n);
    int len = strlen(str);
    long i = len;
    while(len < n){
        while(i < n) i*=2;
        if(n > i/2){
             n = (n-1)%(i/2);
             if(n == 0){
                n = 1;
                break;
             }
        }
        i /= 2;
    }
    printf("%c",str[n-1]);
    return 0;
}